/**
 * 
 */
package com.dsbridge.bank.business;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dsbridge.bank.dao.PaymentDAO;
import com.dsbridge.bank.model.Payment;

/**
 * @author Naveen
 * 
 */
@Service
public class PaymentBusinessService implements PaymentBusinessServiceInterface {
	@Autowired
	private PaymentDAO pdao;

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.PaymentBusinessServiceInterface#insert(com.dsbridge.bank.model.Payment)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Payment insert(Payment p) {
		int i = pdao.insert(p);
		p.setPaymenttransid(i);
		return p;

	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.PaymentBusinessServiceInterface#update(com.dsbridge.bank.model.Payment)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Payment update(Payment p) throws SQLException {
		int j = pdao.update(p);
		return p;

	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.PaymentBusinessServiceInterface#delete(com.dsbridge.bank.model.Payment)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Payment delete(Payment p) throws SQLException {
		int k = pdao.delete(p);
		return p;

	}

	/* (non-Javadoc)
	 * @see com.dsbridge.bank.business.PaymentBusinessServiceInterface#retrievePaymentbyTaxid(int)
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED)
	public Payment retrievePaymentbyTaxid(int taxid) throws SQLException {

		Payment p = pdao.retrievePaymentbyTaxid(taxid);

		return p;

	}
}